function getMenuTree(
    {
        roleId = null,
        onClick = Function(),
        onRemove = Function(),
        callback = Function(),

    }
) {
    const $dom = $('<ul class="ztree ztree-slack ztree-solid-arrow"></ul>');
    queryMenuList({
        roleId
    }, ({Code, Message, Result}) => {
        const menuList = Result ? Result : [];
        const zTree = initMenuTree(menuList);
        callback(zTree);
    });

    return $dom;

    function initMenuTree(menuList = []) {
        const list = [];
        menuList.forEach(item => {
            const {title, menuId, parentMenuId} = item;
            list.push({
                pId: parentMenuId || 0,
                id: menuId,
                name: title,
                open: true,
                data: item
            })
        })


        return $.fn.zTree.init($dom, {
            data: {
                simpleData: {
                    enable: true
                }
            },
            view: {
                dblClickExpand: false,
                selectedMulti: false,
                showIcon: false,
                showLine: true
            },
            edit: {
                enable: false,
                showRenameBtn: false
            },
            callback: {
                onClick(event, treeId, treeNode) {
                    return onClick(treeNode);
                },
                beforeRemove(treeId, treeNode) {
                    console.log(treeNode)
                    return onRemove(treeNode);
                }
            }
        }, list);
    }

    function queryMenuList(param, callback = Function()) {
        return $.sApi({
            data: param,
            url: "/api/Menu/queryMenuList",
        }, callback)
    }
}